package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/theme"
	"image/color"
)

/*
  完全实现一个接口
*/
type myTheme struct {

}

func (m *myTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
	switch n {
	case theme.ColorNameBackground:
		if v == theme.VariantLight {
			return &color.NRGBA{R: 0xcf, G: 0xd8, B: 0xdc, A: 0xff}
		}
		return &color.NRGBA{R: 0x45, G: 0x5A, B: 0x64, A: 0xff}
	case theme.ColorNameFocus:
		return &color.NRGBA{R: 0xff, G: 0xc1, B: 0x07, A: 0xff}
	}
	return theme.DefaultTheme().Color(n, v)
}

func (m *myTheme) Size(s fyne.ThemeSizeName) float32 {
	return theme.DefaultTheme().Size(s)
}

func (m *myTheme) Font(s fyne.TextStyle) fyne.Resource {
	return theme.DefaultTheme().Font(s)
}

func (m *myTheme) Icon(i fyne.ThemeIconName) fyne.Resource {
	return theme.DefaultTheme().Icon(i)
}